package com.ruoyi.system.mapper;

import java.util.List;
import com.ruoyi.system.domain.FyPolicy;
import com.ruoyi.system.domain.vo.web.WebFyPolicyVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 政策Mapper接口
 *
 * @author ruoyi
 * @date 2025-06-05
 */
public interface FyPolicyMapper
{
    /**
     * 查询政策
     *
     * @param policyId 政策主键
     * @return 政策
     */
    public FyPolicy selectFyPolicyByPolicyId(Long policyId);

    /**
     * 查询政策列表
     *
     * @param fyPolicy 政策
     * @return 政策集合
     */
    public List<FyPolicy> selectFyPolicyList(FyPolicy fyPolicy);

    @Select("<script> select policy_id as policyId, \n" +
            "pub_time as pubTime,\n" +
            "policy_title as policyTitle,\n" +
            "source as source,\n" +
            "brief as brief,\n" +
            "content as content  from fy_policy" +
            "<where>\n" +
            "            <if test=\"policyTitle != null  and policyTitle != ''\"> and policy_title like concat('%', #{policyTitle}, '%')</if>\n" +
            "            and is_delete = 0\n" +
            "        </where> </script>")
    public List<WebFyPolicyVo> selectWebPolicyList(@Param("policyTitle") String policyTitle);

    /**
     * 新增政策
     *
     * @param fyPolicy 政策
     * @return 结果
     */
    public int insertFyPolicy(FyPolicy fyPolicy);

    /**
     * 修改政策
     *
     * @param fyPolicy 政策
     * @return 结果
     */
    public int updateFyPolicy(FyPolicy fyPolicy);

    /**
     * 删除政策
     *
     * @param policyId 政策主键
     * @return 结果
     */
    public int deleteFyPolicyByPolicyId(Long policyId);

    /**
     * 批量删除政策
     *
     * @param policyIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFyPolicyByPolicyIds(Long[] policyIds);
}
